let token=getCookie('token')
    // 获取订单列表
    $.ajax({
        type:'post',
        url:'https://api.it120.cc/conner/order/list',
        data:{
            token
        }
    }).then(res=>{
        let {goodsMap}=res.data
        var xiabiao
        // zong：总订单
        let zong=''
        $.each(goodsMap,function(index,value){
            xiabiao=index
           
            let list=''
            let sum=0
            // 一条订单
            let one_order=''
            value.forEach(item => {
                let z=['已过期','未支付','已支付']
                sum+=item.amount
                list+=`
                    <div class="list">
                    <span><img src="${item.pic}" alt=""></span>
                    <span>${item.goodsName}</span>
                    <span>${item.dateAdd}</span>
                    <span>${item.dateAdd}</span>
                    <span>${z[item.status+1]}</span>
                    </div>
                    `
            })
            list+=`
                <div class="zong_pri">
                    <span>总价</span>
                    <span>${sum}</span>
                    <button class="delete" orderId='${xiabiao}'>删除</button>
                </div>
                `
            one_order=`
                        <div class="one_order">
                            ${list}    
                        </div>
                     `
            zong+=one_order
        })
        
        $('main').html(zong)
        
    })

    // 删除订单
    $('main').delegate('.delete','click',function(){
        let orderId=$(this).attr('orderId')
        $.ajax({
            type:'post',
            url:'https://api.it120.cc/conner/order/delete',
            data:{
                token,
                orderId
            }
        }).then(res=>{
            
        })
        $(this).parent().parent().remove()
    })
